import logging

from PIL import Image
from selenium import webdriver
from selenium.webdriver.common.by import By

from utils.captcha import get_captcha

# logging.basicConfig(level=logging.DEBUG)
# logger = logging.getLogger('selenium')
# logger.setLevel(logging.DEBUG)
def test01():
    driver = webdriver.Chrome()
    driver.get("https://www.baidu.com/")
    driver.find_element(by=By.ID,value='kw').send_keys("你好")
    driver.find_element(by=By.ID,value='su').click()


def test02():
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get('http://localhost:8088/jpress/user/register')
    code = get_captcha(driver,"captchaimg")
    print("===============================")
    print(code)

if __name__ =="__main__":
    test02()